<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">{$title}</div>
                </div>
				<div class="widget-body am-fr">
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom-xs am-fr">
                        <form class="toolbar-form" action="{:url('order/export_order')}" method="post">
                            <div class="am-u-sm-12">
                                <div class="am fr">
                                    <div class="am-form-group tpl-form-border-form am-fl">
                                        <input type="text" name="data[star]"
                                               class="am-form-field"
                                               value="" placeholder="请选择起始日期"
                                               data-am-datepicker required>
                                    </div>
                                    <div class="am-form-group tpl-form-border-form am-fl">
                                        <input type="text" name="data[end]"
                                               class="am-form-field"
                                               value="" placeholder="请选择截止日期"
                                               data-am-datepicker required>
                                    </div>
                                    <div class="am-form-group am-fl">
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <button class="am-btn am-btn-secondary am-radius" type="submit">
                                                    <span class="am-icon-download"></span> 订单导出
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <form class="toolbar-form" action="{:url('order/all')}">
                            <div class="am-u-sm-12">
                                <div class="am-fr">
                                    <div class="am-form-group am-fl">
                                        <div class="am-input-group am-input-group-sm tpl-form-border-form">
                                            <input type="text" class="am-form-field" name="search"
                                                   placeholder="请输入订单号" value="{$search}">
                                            <div class="am-input-group-btn">
                                                <button class="am-btn am-btn-default am-icon-search" type="submit"></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="order-list am-scrollable-horizontal am-u-sm-12 am-margin-top-xs">
                        <table width="100%" class="am-table am-table-hover tpl-table-black am-table-centered am-text-nowrap am-margin-bottom-xs">
                            <thead>
                            <tr>
                                <th>配送信息</th>
                                <th>物品信息</th>
                                <th>骑手信息</th>
                                <th>付款信息</th>
                                <th>订单状态</th>
                                <th>管理操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {if !$list->isEmpty()}
                                {foreach $list as $order}
                                <tr class="order-empty">
                                    <td colspan="6"></td>
                                </tr>
                                <tr>
                                    <td class="am-text-middle am-text-left" colspan="6">
										<span class="am-margin-right-lg"># {$order['order_mode']['text']} #</span>
										<span class="am-margin-right-lg"> 配送距离：≈{$order['distance']['text']} </span>
										<span class="am-margin-right-lg"> 起送时间： {$order['start_time']['text']} </span>
                                        <span class="am-margin-right-lg">订单号：{$order['order_no']}</span>
                                        <span class="am-margin-right-lg">下单时间：{$order['create_time']}</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="am-text-middle am-text-left">
                                        <p>
                                        {$order['address']['name']} 
                                        （{$order['address']['gender']['text']}）
                                        {$order['address']['phone']}
                                        </p>
                                        <p>
                                        {$order['address']['city']}/{$order['address']['district']}/{$order['address']['address']}
                                        </p>
                                        <br>
                                        <p>
                                        {$order['address']['user_name']} 
                                        （{$order['address']['user_gender']['text']}）
                                        {$order['address']['user_phone']}
                                        </p>
                                        <p>
                                        {$order['address']['user_city']}/{$order['address']['user_district']}/{$order['address']['user_address']}
                                        </p>
                                    </td>
                                    <td class="am-text-middle am-text-left">
                                        <p>名称：{$order['goods']['name']}</p>
                                        <p>重量：{$order['goods']['weight']}Kg</p>
                                        <p>价值：￥{$order['goods']['price']}</p>
                                        <p>保价：{$order['goods']['is_insured']['text']}</p>
                                        <p>保温箱：{$order['goods']['is_incubator']['text']}</p>
                                    </td>
                                    <td class="am-text-middle am-text-left">
                                        {if $order['delivery_status']['value']>10 and $order['delivery']}
                                        <p>{$order['delivery']['linkman']|default='--'} （{$order['delivery']['gender']|default='--'}）</p>
                                        <p>{$order['delivery']['phone']|default='--'}</p>
                                        {/if}
                                    </td>
                                    <td class="am-text-middle">
                                        <p>￥{$order['pay_price']}</p>
                                        {if $order['weight_price'] > 0}
                                        <p class="am-link-muted">(超重费用：+￥{$order['weight_price']})</p>
                                        {/if}
										{if $order['insured_price'] > 0}
											<p class="am-link-muted">(保价费用：+￥{$order['insured_price']})</p>
										{/if}
										{if $order['return_price'] > 0}
											<p class="am-link-muted">(返程费用：+￥{$order['return_price']})</p>
										{/if}
										{if $order['activity_price'] > 0}
											<p class="am-link-muted">(优惠金额：-￥{$order['activity_price']})</p>
										{/if}
										{if $order['vip_price'] > 0}
											<p class="am-link-muted">(会员优惠：-￥{$order['vip_price']})</p>
										{/if}
										{if $order['refund_price'] > 0}
											<p>退款金额：-￥{$order['refund_price']}</p>
										{/if}
                                    </td>
                                    <td class="am-text-middle">
                                        <p>付款状态：
                                            <span class="am-badge
                                        {$order['pay_status']['value'] == 10 ? '' : ' am-badge-success'}">
                                                {$order['pay_status']['text']}
                                            </span>
                                        </p>
                                        <p>接单状态：
                                            <span class="am-badge
                                        {$order['shop_status']['value'] == 10 ? '' : ' am-badge-success'}">
                                                {$order['delivery_status']['text']}
                                            </span>
                                        </p>
                                        <p>配送状态：
                                            <span class="am-badge
                                        {$order['delivery_status']['value'] == 20 ? 'am-badge-warning' : ''} 
                                        {$order['delivery_status']['value'] == 30 ? 'am-badge-success' : ''}">
                                                {$order['delivery_status']['text']}
                                            </span>
                                        </p>
                                        <p>收货状态：
                                            <span class="am-badge
                                        {$order['receipt_status']['value'] == 10 ? '' : ' am-badge-success'}">
                                                {$order['receipt_status']['text']}
                                            </span>
                                        </p>
										<p>订单状态：
    										<span class="am-badge
                                            {$order['order_status']['value'] == 10 ? 'am-badge-warning' : ''}
    										{$order['order_status']['value'] == 20 ? 'am-badge-danger' : ''}
    										{$order['order_status']['value'] == 30 ? 'am-badge-success' : ''}">
    										{$order['order_status']['text']}
											</span>
                                        </p>
                                    </td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            {if $order['order_status']['value'] == 10}
                                            {if $order['delivery_status']['value'] < 30}
                                                <a class="hema-cancel tpl-table-black-operation-warning"
                                                   href="javascript:;"
                                                   data-id="{$order['order_id']}">
                                                    取消订单
                                                </a>
                                            {/if}
                                            {if $order['pay_status']['value'] == 20 and $order['delivery_status']['value'] == 10}
                                                <a class="hema-confirm tpl-table-black-operation-del"
                                                   href="javascript:;"
                                                   data-id="{$order['order_id']}">
                                                    确认接单
                                                </a>
                                            {/if}
                                            {if $order['delivery_status']['value'] == 30}
                                                <a class="hema-complete tpl-table-black-operation-del"
                                                   href="javascript:;"
                                                   data-id="{$order['order_id']}">
                                                    确认完成
                                                </a>
                                            {/if}
                                            {/if}
                                        </div>
                                    </td>
                                </tr>
                                {/foreach}
                            {else /}
                                <tr>
                                    <td colspan="6" class="am-text-center">暂无记录</td>
                                </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr">{:$list->render()} </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：{:$list->total()}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $('.hema-confirm').del('id', "{:url('order/confirm')}",'确定要完成订单');
        $('.hema-cancel').del('id', "{:url('order/cancel')}",'确定要取消订单');
        $('.hema-complete').del('id', "{:url('order/complete')}",'确定要完成订单');
    });
</script>